let $gotoDlg = (function() {
  let html = `
    <div class="notepad-dlg-goto">
      <div class="notepad-dlgbox">
        <div class="titlebar">
          <p class="title">查找</p>
          <span class="close-btn">×</span>
        </div>
        <div class="main">
          <label>查找内容(<u>N</u>):</label>
          <input id="txtline" class="txt-line-num" type="text" autofocus>
          <br>
          
          <br>
          <div class="check">
            <input type="checkbox" value="case-sensitive" checked>区分大小写(<u>C</u>)
            <input type="checkbox" value="loop">循环(<u>R</u>)
          </div>
          
          <fieldset class="search-direction">
            <legend>方向</legend>
            <input type="radio" name="dir" value="up">向上(<u>U</u>)
            <input type="radio" name="dir" value="down" checked>向下(<u>D</u>)
          </fieldset>
          <input class="btn-search" type="button" value="查找下一个(F)">
          <input class="btn-cancel" type="button" value="取消">
        </div>
      </div>
    </div> `;



  //设计时，运行时
  let $dlg = $(html),
      cfg = {
        container: 'body',
        title:     '同意',
        delay:     6,
        enabled:   false,
        onClick:   null
      },
      timer = null;

  function destroy() {
    $dlg.remove();
  }

  var $btnClose  = $dlg.find('.close-btn'),
      $titleBar  = $dlg.find('.titlebar'),
      $btnCancel = $dlg.find('.btn-cancel'),
      $btnSearch = $dlg.find('.btn-search');


  
  
  function consg() {
    var text = document.getElementById('txtline').value;
    console.log(text);
  }
  

  function show(config) {
    //gen dom
    //$.extend(cfg,config);
    $('body').append($dlg);
    $dlg.find('.notepad-dlgbox').draggable({handle: $titleBar});

    
    $btnClose.click(destroy);
    $btnCancel.click(destroy);
    $btnSearch.click(consg);

    //event bind
     
  }



  return {
    show,destroy
  }
})();

/*UI组件得面向对象封装，两种方式
  1. {} Object
  let $timerBtn = {
    show:function() {}
  };

  2. 工厂函数（匿名函数的立即执行表达式 + 闭包）
  封装：
  let $timerBtn = (function() {
    //...
    //
    function show() {

    }

    return {
      show
    }
  })();
  使用：
  $tiemrBtn.show();

  3. 构造函数
  function TimerBtn() {

    this.show = function() {}
  }

  使用：
  let btn = new TimerBtn();
  btn.show();
*/
